from django.db import models
from django.contrib.auth import get_user_model

User = get_user_model()

class BookingPost(models.Model):
    user = models.ForeignKey(User, on_delete=models.CASCADE)
    title = models.CharField(max_length=100)
    description = models.TextField()
    camera_info = models.CharField(max_length=100)
    price_per_hour = models.DecimalField(max_digits=6, decimal_places=2)
    latitude = models.FloatField()
    longitude = models.FloatField()
    created_at = models.DateTimeField(auto_now_add=True)

    def __str__(self):
        return self.title

class BookingPostImage(models.Model):
    post = models.ForeignKey(BookingPost, related_name='images', on_delete=models.CASCADE)
    image = models.ImageField(upload_to='booking_images/')